<template>
  <div class="home-container">
    <div class="home-box">欢迎来到通讯大数据分析系统</div>
    <div class="data-display">
      <div class="data-card">
        <div class="data-title"><el-icon><AlarmClock /></el-icon>今日日期</div>
        <div class="data-value" style="color: #e48585">{{ msgDay }}</div>
      </div>
      <div class="data-card">
        <div class="data-title"><el-icon><ChatDotRound /></el-icon>今日总消息量</div>
        <div class="data-value" style="color: #8719ac">{{ totalMsgCnt }}</div>
      </div>
      <div class="data-card">
        <div class="data-title"><el-icon><UserFilled /></el-icon>今日发送消息用户数</div>
        <div class="data-value" style="color: #2c94d5">{{ senderUserCnt }}</div>
      </div>
      <div class="data-card">
        <div class="data-title"><el-icon><Avatar /></el-icon>今日接收消息用户数</div>
        <div class="data-value" style="color: #e3b10f">{{ receiverUserCnt }}</div>
      </div>
    </div>
    <div class="nav">
      <div class="image">
        <img src="@/img/lunbo1.jpg" alt="">
        <img src="@/img/lunbo2.jpg" alt="">
        <img src="@/img/lunbo3.jpg" alt="">
        <img src="@/img/lunbo4.jpg" alt="">
      </div>
    </div>
  </div>
</template>

  <script>
  import { fetchData } from '../Api/api.js';


  export default {
    data() {
      return {
        msgDay: '',
        totalMsgCnt: 0,
        senderUserCnt: 0,
        receiverUserCnt: 0,
      };
    },

    async mounted() {
      const data = await fetchData('getone');
      this.msgDay = data.msgDay;
      this.totalMsgCnt = data.totalMsgCnt;
      const res = await fetchData('getfour');
      this.senderUserCnt = res.senderUserCnt;
      this.receiverUserCnt = res.receiverUserCnt;
    },
    methods: {
    },
  };
  </script>

  <style>
  .home-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .home-box {
    max-width: 1000px;
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 30px;
    font-family: 微软雅黑;
    padding: 15px;
    background: linear-gradient(90deg, rgba(255,255,255,0.8) 0%, rgba(255,255,255,0.9) 100%);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px);
    border-left:5px solid #2e7d32;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
  }
  .data-display {
    display: flex;
    gap: 30px;
    z-index: 2;
    align-items: center;
    margin-left: 10px;
  }
  .data-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    padding: 25px 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    min-width: 100px;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
  }
  .data-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  }
  .data-title {
    font-size: 16px;
    color: black;
    margin-bottom: 10px;
    font-weight: 500;
  }
  .data-value {
    font-size: 32px;
    font-weight: bold;
  }
  .nav {
    margin: 0 auto;
    width: 98%;
    height: 500px;
    position: relative;
    top: 0;
    left: 0;
    overflow: hidden;
  }
  .image {
    img  {
      padding-top: 30px;
      width: 100%;
      height: 430px;
    }
    width: 100%;
    white-space: nowrap;
    position: absolute;
    top: 0;
    right: 0;
    animation: imageToggle ease-out 20s infinite;
  }
  @keyframes imageToggle {
    0% ,
    20%{
      right: 0;
    }
    25%,
    45% {
      right: 100%;
    }
    50%,
    70%{
      right: 200%;
    }
    75%,
    95% {
      right: 300%;
    }
    100% {
      right: 0;
    }
  }
  </style>